package com.fgr.service.Impl;

import com.fgr.beans.Reserve;
import com.fgr.mapper.ReserveMapper;
import com.fgr.service.ReserveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReserveServiceImpl implements ReserveService {
    @Autowired
    ReserveMapper reserveMapper;
    @Override
    public String addReserve(Reserve reserve) {

        Integer integer = reserveMapper.addReserve(reserve);

        if (integer>0){
            return "SUCCESS";
        }else {
            return "ERRO";
        }
    }

    @Override
    public List<Reserve> findReserveByTypeBg(String reType) {
        List<Reserve> reserves = reserveMapper.findReserveByTypeBg(reType);
        return reserves;
    }

    @Override
    public Reserve findReserveByReId(Integer reId) {
        Reserve reserve = reserveMapper.findReserveByReId(reId);
        return reserve;
    }

    @Override
    public String deleteReserveByTypeBg(Integer reId) {
        Integer integer = reserveMapper.deleteReserveByTypeBg(reId);
        if (integer>0){
            return "SUCCESS";
        }else {
            return "ERRO";
        }
    }

    @Override
    public String UpdateReserve(Reserve reserve) {
        Integer integer = reserveMapper.UpdateReserve(reserve);
        if (integer>0){
            return "SUCCESS";
        }else {
            return "ERRO";
        }
    }
}
